package com.yuyue.dronesystem.utils;

import java.util.Objects;

/**
 * myMessage
 */
public class myMessage {

    private Boolean flag;
    private String info;
    private Object result;


    myMessage() {
    }

    void setFlag(Boolean flag) {
        this.flag = flag;
    }

    void setInfo(String info) {
        this.info = info;
    }

    void setResult(Object result) {
        this.result = result;
    }

    public Boolean getFlag() {
        return flag;
    }

    public String getInfo() {
        return info;
    }

    public Object getMessage() {
        return result;
    }

    public static myMessage success() {
        myMessage message = new myMessage();
        message.setFlag(true);
        message.setInfo("success");
        message.setResult("");
        return message;
    }

    public static myMessage success(String info) {
        myMessage message = new myMessage();
        message.setFlag(true);
        message.setInfo(info);
        message.setResult("");
        return message;
    }

    public static myMessage success(String info, Object result) {
        myMessage message = new myMessage();
        message.setFlag(true);
        message.setInfo(info);
        message.setResult(result);
        return message;
    }

    public static myMessage error() {
        myMessage message = new myMessage();
        message.setFlag(false);
        message.setInfo("error");
        message.setResult("");
        return message;
    }

    public static myMessage error(String info) {
        myMessage message = new myMessage();
        message.setFlag(false);
        message.setInfo(info);
        message.setResult("");
        return message;
    }

    public static myMessage error(String info, Exception exception) {
        myMessage message = new myMessage();
        message.setFlag(false);
        message.setInfo(info);
        message.setResult(exception);
        return message;
    }
}